package bavaria.hightech.banking;

/**
 * Money-Objects for each transaction with value and currency
 * 
 * @author Christian
 */
public class Money {
	
	private long value;
	private ECurrency currency;
	
	public Money(long value, ECurrency currency){
		this.value = value;
		this.currency = currency;
	}
	
	public long getValue(){
		return value;
	}
	
	public ECurrency getCurrency(){
		return currency;
	}
	
	public boolean equalCurrency(Money money){
		return (this.currency == money.currency);
	}
	
	public boolean add(Money money){
		this.value += money.value;
		
		return true;
	}
	
	public boolean sub(Money money){
		this.value -= money.value;
		
		return true;
	}
	
	public boolean equals(Money money){
		return ((this.value == money.value)&&(this.currency == money.currency));
	}
	
	/**
	 * Returns whether transfered value is bigger than existing value
	 * @param money Money-Object (Value and Currency) which should be compared 
	 * @return true for transfered value is bigger
	 */
	public boolean biggerValue(Money money){
		return (this.value < money.value);
	}
	
	/**
	 * Returns whether transfered value is lower than existing value
	 * @param money Money-Object (Value and Currency) which should be compared
	 * @return true for transfered value is lower
	 */
	public boolean lowerValue(Money money){
		return (this.value > money.value);
	}
	
	public String toString(){
		return (value + " " + currency);
	}
}
